package collision;

import java.util.ArrayList;
import java.util.List;
import com.golden.gamedev.object.SpriteGroup;
import com.golden.gamedev.object.collision.BasicCollisionGroup;

public class SpaceCollisionManager {

    private List<SpriteGroup> spriteGroups;
    private List<BasicCollisionGroup> collisions;

    public SpaceCollisionManager() {
        spriteGroups = new ArrayList<SpriteGroup>();
        collisions = new ArrayList<BasicCollisionGroup>();
    }

    public void addToCollisions(SpriteGroup spriteGroup) {
        for (SpriteGroup s : spriteGroups) {
            BasicCollision newCollision = new BasicCollision(spriteGroup, s);
            collisions.add(newCollision);
        }

        spriteGroups.add(spriteGroup);
    }

    public void update(long elapsedTime) {
        for (BasicCollisionGroup c : collisions) {
            c.checkCollision();
        }
    }

    public void addToCollisions(List<SpriteGroup> groups) {
        for (SpriteGroup s : groups) {
            addToCollisions(s);
        }

    }
}
